<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="./lib//codemirror.css">
    <script src="./lib//codemirror.js"></script>
    <script src="./mode/python/python.js"></script>
    <script src="./mode/xml/xml.js"></script>
    <!--自动补全-->
<link rel="stylesheet" href="./addon/hint/show-hint.css">
<script src="./addon/hint/show-hint.js"></script>
<script src="./addon/hint/sql-hint.js"></script>

</head>

<body>
    <textarea id="root"></textarea>
    <script>
      var test = document.getElementById("root");
        test.innerHTML = "print(666)"; //方法1

        var editor = CodeMirror.fromTextArea(document.getElementById('root'), {
            lineNumbers: true, // 显示行号
        });
    </script>
</body>

</html>